#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>

void reverse(int*left,int*right)
{
	while (left < right)
	{
		int temp = *left;
		*left = *right;
		*right = temp;
		left++;
		right--;

	}

}

void rotate(int* nums, int numsSize, int k)
{
	k = numsSize - k % numsSize;
	reverse(nums, nums + k - 1);
	reverse(nums + k, nums + numsSize - 1);
	reverse(nums, nums + numsSize - 1);


}

int main()
{
	int arr[] = {1,2,3,4,5,6,7};
	//reverse(arr, arr + 4);
	rotate(arr, 7,1 );

	for (int i = 0; i < 7; i++)
		printf("%d ", arr[i]);

	return 0;
}